import { HttpClient, HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ServiceWorkerModule } from '@angular/service-worker';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { ActionSheetModule, TabModule, WeUiModule } from 'ngx-weui';
import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { RestDataSource } from './auth/rest-data-source';
import { CoreModule } from './core/core.module';
import { AgencyComponent } from './index/AGENCY/index.component';
import { IndexHomeComponent } from './index/home/index.component';
import { IndexComponent } from './index/index.component';
import { LoginComponent } from './page/login/index.component';
import { PageModule } from './page/page.module';
import { RegisterComponent } from './page/register/index.component';
import { RechargeComponent } from './recharge/recharge.component';
import { OrderDetailComponent } from './userCenter/orderDetail';
import { SecurityComponent } from './userCenter/security';
import { UpdatePwdComponent } from './userCenter/updatePwd';
import { UserCenterComponent } from './userCenter/userCenter';
import { WithdrawComponent } from './userCenter/withdraw';
import { OrderComponent } from './index/order/index.component';
import { GuideComponent } from './index/GUIDE/index.component';
import { PayPasswordComponent } from './components/pay-password/payPassword';
import { RechargeSuccessComponent } from './recharge/rechargeSuccess';
import { ClipboardModule } from 'ngx-clipboard';
import { NgxQRCodeModule } from 'ngx-qrcode2';
import { CountdownModule } from 'ngx-countdown';
import { LoginDialogComponent } from './components/login-dialog/loginDialog';
import { GzComponent } from './page/gz/index.component';
import { UserDelComponent } from './userCenter/userDetail';

export function createTranslateLoader(http: HttpClient) {
	return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

@NgModule({
	declarations: [
		GzComponent,
		AppComponent,
		AgencyComponent,
		IndexComponent,
		IndexHomeComponent,
		RechargeComponent,
		LoginComponent,
		RegisterComponent,
		OrderComponent,
    	GuideComponent,
		UserCenterComponent,
		OrderDetailComponent,
		SecurityComponent,
		UpdatePwdComponent,
        WithdrawComponent,
        PayPasswordComponent,
		RechargeSuccessComponent,
		UserDelComponent,
		LoginDialogComponent
	],
	imports: [
		TranslateModule.forRoot({
			loader: {
				provide: TranslateLoader,
				useFactory: createTranslateLoader,
				deps: [HttpClient],
			},
		}),
		NgxQRCodeModule,
		ClipboardModule,
		ActionSheetModule,
		TabModule,
		BrowserModule,
		WeUiModule,
		BrowserAnimationsModule,
		ServiceWorkerModule.register('/ngsw-worker-polyfill.js', { enabled: environment.production }),
		AppRoutingModule,
		HttpClientModule,
		CoreModule,
		CommonModule,
		FormsModule,
		ReactiveFormsModule,
		PageModule,
		CountdownModule
	],
	providers: [RestDataSource],
	bootstrap: [AppComponent],
})
export class AppModule {}
